<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>电脑 - TechZone电子设备商城</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://code.iconify.design/3/3.1.1/iconify.min.js"></script>
    <style>
        .hide-scrollbar::-webkit-scrollbar { display: none; }
        .hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
        .content-container { max-width: 1200px; margin: 0 auto; }
        .hero-slide { height: 500px; }
        .category-card:hover { transform: translateY(-5px); }
        .product-card { transition: all 0.3s ease; }
        .product-card:hover { box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1); }
        .btn-primary { background-color: #3b82f6; }
        .btn-primary:hover { background-color: #2563eb; }
        .btn-secondary { border: 2px solid #3b82f6; color: #3b82f6; }
        .btn-secondary:hover { background-color: #dbeafe; }
        .nav-link { position: relative; }
        .nav-link::after { content: ''; position: absolute; bottom: -2px; left: 0; width: 0; height: 2px; background-color: #3b82f6; transition: width 0.3s ease; }
        .nav-link:hover::after { width: 100%; }
        .nav-link.active::after { width: 100%; }
    </style>
</head>
<body class="bg-gray-50 text-gray-800">
    <!-- 顶部导航栏 -->
    <nav class="fixed top-0 left-0 right-0 bg-gray-900 text-white z-50 shadow-md">
        <div class="content-container flex items-center justify-between py-4">
            <div class="flex items-center">
                <span class="iconify text-3xl mr-2" data-icon="ion:hardware-chip"></span>
                <a href="index.html" class="text-xl font-bold hover:text-blue-400 transition-colors">TechZone</a>
            </div>
            
            <div class="flex space-x-8">
                <a href="index.html" class="nav-link">首页</a>
                <a href="mobile.html" class="nav-link">手机</a>
                <a href="computer.html" class="nav-link active">电脑</a>
                <a href="headphones.html" class="nav-link">耳机</a>
                <a href="wearable.html" class="nav-link">智能穿戴</a>
            </div>
            
            <div class="flex items-center space-x-4">
                <div class="relative">
                    <input type="text" placeholder="搜索电脑..." class="px-4 py-2 rounded-full bg-gray-800 text-white focus:outline-none focus:ring-2 focus:ring-blue-500">
                </div>
                <!-- 个人中心按钮 -->
                <button id="profile-btn" class="flex items-center hover:text-blue-400 transition-colors">
                    <span class="iconify text-xl" data-icon="mdi:account"></span>
                </button>
                <!-- 购物车按钮 -->
                <button id="cart-btn" class="flex items-center hover:text-blue-400 transition-colors relative">
                    <span class="iconify text-xl" data-icon="mdi:cart"></span>
                    <span id="cart-count" class="absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center hidden">0</span>
                </button>
            </div>
        </div>
    </nav>

    <!-- 电脑分类头部横幅 -->
    <div class="mt-16 bg-gradient-to-r from-indigo-600 to-indigo-800 py-16">
        <div class="content-container text-white">
            <h2 class="text-4xl font-bold mb-4">笔记本电脑</h2>
            <p class="text-xl opacity-90">探索高性能笔记本电脑，满足办公与娱乐的双重需求</p>
        </div>
    </div>

    <section class="py-8 bg-gray-100">
        <div class="content-container">
            <div class="flex flex-wrap justify-between items-center gap-4">
                <div class="flex flex-wrap gap-3">
                    <button class="bg-white px-4 py-2 rounded-full shadow-sm hover:shadow transition-shadow">全部品牌</button>
                </div>
                
                <div class="flex flex-wrap gap-3">
                    <button class="bg-white px-4 py-2 rounded-full shadow-sm hover:shadow transition-shadow">全部类型</button>
                </div>
                      
                </div>
            </div>
        </div>
    </section>

    <!-- 电脑产品展示 -->
    <section class="py-12">
        <div class="content-container">
            <div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
                <!-- 电脑产品1 -->
                <div class="product-card bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <img src="images/products/BB460B0B588041CFD4C93FAD72A68F46.jpg" alt="轻薄笔记本电脑 Air" class="w-full h-48 object-contain mb-4">
                        <h3 class="text-xl font-semibold">轻薄笔记本电脑 Air</h3>
                        <p class="text-gray-600 mt-2 text-sm">13.3英寸2K屏 | i7处理器 | 16GB内存 | 1TB SSD</p>
                        <div class="mt-3 flex items-center">
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-yellow-400"><span class="iconify" data-icon="mdi:star-half"></span></span>
                            <span class="text-gray-500 text-sm ml-2">(256)</span>
                        </div>
                    </div>
                    <div class="px-6 pb-6 pt-2 border-t border-gray-100">
                        <div class="flex justify-between items-center">
                            <div>
                                <span class="text-2xl font-bold">¥7999</span>
                                <span class="text-gray-500 line-through text-sm ml-2">¥8499</span>
                            </div>
                            <button class="add-to-cart-btn btn-primary px-4 py-2 rounded-full text-white font-medium text-sm"
                                    data-id="301" 
                                    data-name="轻薄笔记本电脑 Air" 
                                    data-price="7999" 
                                    data-image="images/products/BB460B0B588041CFD4C93FAD72A68F46.jpg">
                                加入购物车
                            </button>
                        </div>
                    </div>
                </div>
                
                <!-- 电脑产品2 -->
                <div class="product-card bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <img src="images/products/03.jpg" alt="联想拯救者y9000p" class="w-full h-48 object-contain mb-4">
                        <h3 class="text-xl font-semibold">联想拯救者y9000p</h3>
                        <p class="text-gray-600 mt-2 text-sm">17.3英寸144Hz | i9处理器 | RTX 4090 | 32GB内存</p>
                        <div class="mt-3 flex items-center">
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-yellow-400"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-gray-500 text-sm ml-2">(189)</span>
                        </div>
                    </div>
                    <div class="px-6 pb-6 pt-2 border-t border-gray-100">
                        <div class="flex justify-between items-center">
                            <div>
                                <span class="text-2xl font-bold">¥11999</span>
                                <span class="text-gray-500 line-through text-sm ml-2">¥11999</span>
                            </div>
                            <button class="add-to-cart-btn btn-primary px-4 py-2 rounded-full text-white font-medium text-sm"
                                    data-id="302" 
                                    data-name="联想拯救者y9000p " 
                                    data-price="11999" 
                                    data-image="https://picsum.photos/seed/gaminglaptop/400/400">
                                加入购物车
                            </button>
                        </div>
                    </div>
                </div>
                
                <!-- 电脑产品3 -->
                <div class="product-card bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <img src="images/products/02.jpg" alt="华为 matebook14" class="w-full h-48 object-contain mb-4">
                        <h3 class="text-xl font-semibold">华为 matebook14 Pro</h3>
                        <p class="text-gray-600 mt-2 text-sm">14.2英寸防窥屏 | 酷睿Ultra5 | 16GB内存 | 512GB SSD</p>
                        <div class="mt-3 flex items-center">
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-gray-300"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-gray-500 text-sm ml-2">(124)</span>
                        </div>
                    </div>
                    <div class="px-6 pb-6 pt-2 border-t border-gray-100">
                        <div class="flex justify-between items-center">
                            <div>
                                <span class="text-2xl font-bold">¥5999</span>
                                <span class="text-gray-500 line-through text-sm ml-2">¥9999</span>
                            </div>
                            <button class="add-to-cart-btn btn-primary px-4 py-2 rounded-full text-white font-medium text-sm"
                                    data-id="303" 
                                    data-name="商务笔记本 Pro" 
                                    data-price="5999" 
                                    data-image="https://picsum.photos/seed/businesslaptop/400/400">
                                加入购物车
                            </button>
                        </div>
                    </div>
                </div>
                
                <!-- 电脑产品4 -->
                <div class="product-card bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="p-6">
                        <img src="images/products/01.jpg" alt="枪神9plus " class="w-full h-48 object-contain mb-4">
                        <h3 class="text-xl font-semibold">枪神9plus</h3>
                        <p class="text-gray-600 mt-2 text-sm">18英寸ROG新云原画屏 | Ultra 9 275HX处理器 | 16GB内存 | 1TB SSD</p>
                        <div class="mt-3 flex items-center">
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-yellow-400 mr-1"><span class="iconify" data-icon="mdi:star-half"></span></span>
                            <span class="text-gray-300"><span class="iconify" data-icon="mdi:star"></span></span>
                            <span class="text-gray-500 text-sm ml-2">(87)</span>
                        </div>
                    </div>
                    <div class="px-6 pb-6 pt-2 border-t border-gray-100">
                        <div class="flex justify-between items-center">
                            <div>
                                <span class="text-2xl font-bold">¥15999</span>
                                <span class="text-gray-500 line-through text-sm ml-2">¥6999</span>
                            </div>
                            <button class="add-to-cart-btn btn-primary px-4 py-2 rounded-full text-white font-medium text-sm"
                                    data-id="304" 
                                    data-name="枪神9plus Flex" 
                                    data-price="15999" 
                                    data-image="https://picsum.photos/seed/2in1laptop/400/400">
                                加入购物车
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 分页 -->
            <div class="mt-12 flex justify-center">
                <div class="flex space-x-2">
                    <button class="w-10 h-10 flex items-center justify-center rounded-full border border-gray-300 hover:border-blue-500 hover:text-blue-500 transition-colors">
                        <span class="iconify" data-icon="mdi:chevron-left"></span>
                    </button>
                    <button class="w-10 h-10 flex items-center justify-center rounded-full bg-blue-500 text-white">1</button>
                    <button class="w-10 h-10 flex items-center justify-center rounded-full border border-gray-300 hover:border-blue-500 hover:text-blue-500 transition-colors">2</button>
                    <button class="w-10 h-10 flex items-center justify-center rounded-full border border-gray-300 hover:border-blue-500 hover:text-blue-500 transition-colors">3</button>
                    <button class="w-10 h-10 flex items-center justify-center rounded-full border border-gray-300 hover:border-blue-500 hover:text-blue-500 transition-colors">...</button>
                    <button class="w-10 h-10 flex items-center justify-center rounded-full border border-gray-300 hover:border-blue-500 hover:text-blue-500 transition-colors">6</button>
                    <button class="w-10 h-10 flex items-center justify-center rounded-full border border-gray-300 hover:border-blue-500 hover:text-blue-500 transition-colors">
                        <span class="iconify" data-icon="mdi:chevron-right"></span>
                    </button>
                </div>
            </div>
        </div>
    </section>

    <!-- 页脚区域 -->
    <footer class="bg-gray-900 text-white py-12">
        <div class="content-container">
            <div class="grid grid-cols-4 gap-8">
                <div>
                    <div class="flex items-center mb-4">
                        <span class="iconify text-3xl mr-2" data-icon="ion:hardware-chip"></span>
                        <h2 class="text-xl font-bold">TechZone</h2>
                    </div>
                    <p class="text-gray-400">领先的电子设备购物平台，提供最新科技产品与专业服务</p>
                </div>
                
                <div>
                    <h3 class="text-lg font-semibold mb-4">快速链接</h3>
                    <ul class="space-y-2 text-gray-400">
                        <li><a href="index.html" class="hover:text-white transition-colors">首页</a></li>
                        <li><a href="mobile.html" class="hover:text-white transition-colors">手机</a></li>
                        <li><a href="computer.html" class="hover:text-white transition-colors">电脑</a></li>
                        <li><a href="headphones.html" class="hover:text-white transition-colors">耳机</a></li>
                        <li><a href="wearable.html" class="hover:text-white transition-colors">智能穿戴</a></li>
                    </ul>
                </div>
                
                <div>
                    <h3 class="text-lg font-semibold mb-4">客户服务</h3>
                    <ul class="space-y-2 text-gray-400">
                        <li><a href="#" class="hover:text-white transition-colors">联系我们</a></li>
                        <li><a href="#" class="hover:text-white transition-colors">配送信息</a></li>
                        <li><a href="#" class="hover:text-white transition-colors">退换政策</a></li>
                        <li><a href="#" class="hover:text-white transition-colors">常见问题</a></li>
                    </ul>
                </div>
                
                <div>
                    <h3 class="text-lg font-semibold mb-4">关注我们</h3>
                    <div class="flex space-x-4">
                        <a href="#" class="bg-gray-800 p-2 rounded-full hover:bg-blue-500 transition-colors">
                            <span class="iconify text-xl" data-icon="mdi:weixin"></span>
                        </a>
                        <a href="#" class="bg-gray-800 p-2 rounded-full hover:bg-blue-500 transition-colors">
                            <span class="iconify text-xl" data-icon="mdi:weibo"></span>
                        </a>
                        <a href="#" class="bg-gray-800 p-2 rounded-full hover:bg-blue-500 transition-colors">
                            <span class="iconify text-xl" data-icon="mdi:instagram"></span>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </footer>

    <script>
        // JavaScript代码保持与其他页面一致
        window.addEventListener('load', function() {
            updateLoginStatus();
            updateCartCount();
            
            document.getElementById('profile-btn').addEventListener('click', function() {
                const isLoggedIn = localStorage.getItem('isLoggedIn') === 'true';
                if (isLoggedIn) {
                    window.location.href = 'profile.html';
                } else {
                    window.location.href = 'login.html';
                }
            });
            
            document.getElementById('cart-btn').addEventListener('click', function() {
                const isLoggedIn = localStorage.getItem('isLoggedIn') === 'true';
                if (isLoggedIn) {
                    window.location.href = 'cart.html';
                } else {
                    if (confirm('请先登录查看购物车，是否前往登录？')) {
                        window.location.href = 'login.html';
                    }
                }
            });
            
            document.querySelectorAll('.add-to-cart-btn').forEach(button => {
                button.addEventListener('click', function() {
                    const isLoggedIn = localStorage.getItem('isLoggedIn') === 'true';
                    
                    if (!isLoggedIn) {
                        if (confirm('请先登录才能购买商品，是否前往登录？')) {
                            window.location.href = 'login.html';
                        }
                        return;
                    }
                    
                    const product = {
                        id: this.getAttribute('data-id'),
                        name: this.getAttribute('data-name'),
                        price: parseFloat(this.getAttribute('data-price')),
                        image: this.getAttribute('data-image'),
                        quantity: 1
                    };
                    
                    addToCart(product);
                });
            });
        });
        
        function updateLoginStatus() {
            const isLoggedIn = localStorage.getItem('isLoggedIn') === 'true';
        }
        
        function updateCartCount() {
            const currentUser = localStorage.getItem('currentUser');
            if (!currentUser) return;
            
            const user = JSON.parse(localStorage.getItem('user_' + currentUser));
            if (!user || !user.cart) return;
            
            const totalItems = user.cart.reduce((total, item) => total + item.quantity, 0);
            const cartCountElement = document.getElementById('cart-count');
            
            if (totalItems > 0) {
                cartCountElement.textContent = totalItems;
                cartCountElement.classList.remove('hidden');
            } else {
                cartCountElement.classList.add('hidden');
            }
        }
        
        function addToCart(product) {
            const currentUser = localStorage.getItem('currentUser');
            if (!currentUser) return;
            
            let user = JSON.parse(localStorage.getItem('user_' + currentUser));
            if (!user.cart) {
                user.cart = [];
            }
            
            const existingItemIndex = user.cart.findIndex(item => item.id === product.id);
            
            if (existingItemIndex !== -1) {
                user.cart[existingItemIndex].quantity += 1;
                alert(`${product.name} 已添加到购物车，当前数量: ${user.cart[existingItemIndex].quantity}`);
            } else {
                user.cart.push(product);
                alert(`${product.name} 已添加到购物车`);
            }
            
            localStorage.setItem('user_' + currentUser, JSON.stringify(user));
            updateCartCount();
        }
    </script>
</body>
</html>
    